How do you feel about about early returns here? That would prevent the `sort` recycle with different type, and you'll be able to cut on the breaks. Also you can consider using object instead of `switch` as it may bring more clarity in some cases :)