message and login refactorin