Added collision detection for main object.