Remove use of deque