Java script clean up