Fixed the code formatting

Tried to fix the readability of the code. Moved from indented braces to
unindented. Code as it was was annoying to read. Used the built-in
XCode code format tool to fix the structuring.