Replacing Stack with Deque.