Updated the model with extended login and logout functions.