moved 2 JS to one and fix events