MOdified helper to store data in coockies