header files generated

also moved code generation functions to their own files