Cleanup whitespace and conditions

Done with the help of JSHint ( http://www.jshint.com ).
Merge pull request #364 from amire80/cleanups

Cleanup whitespace and conditions