refactoring a ton of stuff, further progress on documentation