Added optional path and domain arguments for setting cookies.