Improved type safety for min/max calculations
Improving type safety in tests