put collision detection routine into a utilities file instead