come up with a better way to handle edge collisions