refactor DefinitionLoader and OuterParser to have more granular dependen...

...cies

@cos please review