Improve session handling, so incoming/outgoing cookie is only checked/set once