Cleaning up javascript