Lots of fixes, modularized the hell out of it
Added tests. This commit does not imply stability, it is merely where I left off and a preview of the direction I'm taking this