Added Deque. Cleaned up other code.