Cleaned up code for JSHint