Added explicit doLogout method for better readability.