First iteration of the architecture revamp.

Should be ready to merge.