Cleaning up JavaScript