docx generation

fix for heading level
refactoring
rpc file support
bugfixes