Added collision detection functionality. Tests passing.