refactoring in prep for code generation.