added cookie handling, removed fluff