big ugly switch statement