added custom collision detection