added rudimentary collision detection