Removed deque code and imported from collections.