Change pairs method to pass test