Refactored authentication services. Partial test suite.