Improved Login and Sign Up logic