Start using deque. also fixed up doc