implemented rudimentary collision detection