Switch statement instead of if-then-else

Changed if-then-else for getting the cookie value to a switch statement