Added setCookie() function and tested