Fixed the CollisionDetectingBot

FIxes in Collision detecting bot logic, as well as some code
refactoring. Needs more testing, but it seems to be working.