Cleaning up the centralized collision function.