Refactored collision direction detection into helper class