Added beginning of collision detection.