added basic collision detection