refactored and login logout methods added