Cleaning up implementation of LoginListener (renamed from Login) and improving tests