collide func updated to prevent redundant calculation