Added cookie handling