Cookie support added

Nothing has been tested at the moment, but I need to work remotely hence
the early commit.