refined register and login