Simplify stuff and make login/logout bulletproof