Use immutables, add specs for cookie domains, refactor ready for 7.0.0