Updated to segregate login function call