Changed vectors to deque.