Separated login/logout handlers from activities

Fixed #24