Clean up some if-else ladders.