Improve tests and minor refactors
Finish sign in