CHANGED:applied the collision detection and handler function;