Added colision function

must fix bugs