removed unnecessary deque usage