fixed collision detection and implemented mouse clicks