Improved double dispatch for selecting collision function