Make code more readable...

Changes:

 * fix weird indentation such as

   if (foo){
     if (bar){
       baz();}}

 * insert space where appropriate (don't be afraid of spaces, people)

 * add some comments where helpful