add login and logout ability, little refactoring