added cookies handling