refactor generators