cleaning up code for js.