Adding collision detection with unit tests