Merge both collision functions into one