Updated method to create cookie