added logic for storing text in browser cookies