Finish cookie logic in js files, finally