clean up hook JS code