Refactor Pair functionality