added cookie support to remember last url