Cleaned up the collision code