break out logic into pivot.erl