Formatting cleanup, added braces, some added comments