[Minor] using Deque instead of Stack