Added Deque code from class.