Clean up cookie generation code.