add login refactor