Mixed fixes and refactoring

Just a bit of trolling through the code.. Some bug fixes.
Refactoring auth to detach sa= methods.
Docs cleaning.