Cleaned up some code with JSLint and JSHint