Optimize the match expression to be shallowly nested