added cookie support
fixed repeated queries