Improved collision detection, removed Pair class.