start of paired orphan_importer refactor with motasem

no more tests yet
start of pulling methods out but still messy

@motasem-salem  this is the start of my effort at a refactor. I thought this might be quicker than commenting endlessly on code review. I have to go and do something else now so its a work in progress but please let me know what you think so far. If you want to pair on it some more just let me know.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.