Cleanup syntax to make code easier to read
Clean up comments, rearrange order of functions