Added deque and machine learning