Add docs. Fix tests.