Simplify login code