Code cleanup and clarification

Mostly formatting (adding brackets and spaces)