cleanup js code to reduce cohesion between different modules