Moved memory to a deque, speed boost everywhere.