Convert match statement to partial function
Fix shadowing