Tried to improve collision detection and clipping