refactor, add tests, add goauth