refactoring seqgen