added a logoutfunction