updated cookie checking to get rid of slowdown