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

pop(0) incurs O(n) memory movements for python lists as opposed to deque from collections which can do it in O(1)