Wip/rafactor for integration

I'd like to get a few more eyeballs on this.