Cleaned up some JavaScript code.