JSHint and code style fixes