Login-registered refactor