Remove nasty switch statements