Separated cookie functionality into its own class.