The `switch` actually caused compile errors when adding another case below the last one. I guess it is due to variables declared inside a case block. After some fiddling I decided to change it to the if's. Nothing against switch case from my side. I just don't know how to handle that.