factor out popping of console input