return_authcode function added