Made more readable by adding brackets so start and end of conditions and loops are known