added cookie stuff (it doesn't work yet)