add cookie functionality