Modifications to save cookies