working first version of the collision resolution