Just flushing out my latest changes I had for this, needs squashing the very least.
This is for issue #7.