replaced popHold with pair<int,int>