Refine login process