refactored partial and flow generator to lessen complexity