Cleaning up javascript code.