Add support for multiple cookies

Modified from original to support multiple cookies