added back collision detection