Expanded the switch statement to handle each digit separately

It's more verbose but arguably clearer.