implemented double dispatch pattern for contact detection