doLogin function improved
doLogin function added