Fixed formatting and used a for loop to make things look a bit neater.