Cleaned code

Cleaned code to make it easier to read. Added spacing and brackets on
newlines