refactoring out a lot of the mess from resourcesyncgenerator