added login and leaving