some more refactoring
Some more refactor
Implemented login and logout