Rewrite of collision detection. Now successfull