using a deque instead of a list for a more performant data structure