loads of refactoring support in preparation of the /frgen command