optimised login method