Prettyfied code (loosely based on jslint and (not-so-loosely) on project style)