Cleaned up JavaScript code.