Finished cleaning up javascript