Changed Formatting

I've changed some of the formatting to your code, however, you may not want to adopt it if it is more confusing for you to read. Also, please test this code before you merge it.