Cleaned up to pass JSHint and minified