Rewrite & Cleanup

[view individual commits for details]