Refactor: Only one instance of a minmax() needed