Added rudimentary collision detection.