added cookie refresh mechanism