refactor methods generating code.