Substituted list.pop(0) for collections.deque().