more collision detection code