added detectCollisions