I did not mean the definition of the cases, but the code inside. I looks like there was a copy&paste exercise, which I would prefer to be encapsulated in a function, if possible.