queue: implement pop and use queue module