almost working collision detection