[WIP] Began merging multiple codepaths.

I've begun the process of cleaning up and merging the previously split codepaths into a unified one.