refactoring of feature generation