use deque.clear instead of creating new object