moved logic into function (URL & Email)