Setting up unit switching with cookie