updated file to use deque