generator functional / parser refactoring