refractor of login