internal refactoring to move frontend stuff out of generator