Use deque in actions

Improve memory and speed using collections.deque in actions