finish reorg, unify encode pipe across formats