replace redundant generation method with factory build