Cookie - module

make cookie functionality into a module.