first version of with full collision detection