Cleans up the Javscript code