refactoring; added logoff and registration