Added helper for cookie handling and moved getting secure cookie there as well