cleaned js code