use persistent bags for the steps instead of a collections.Counter
pyrsistent 0.4.0 has pbag in it