edge case fix, don't add pairs when you're on the edge