Mostly Done. Needs some testing.