Cookie check function added