Added check for OS platform and reordered code for min/max
Added check for OS platform and reordered code for min/max

andreaspada/EDDiscovery,andreaspada/EDDiscovery,EDDiscovery/EDDiscovery,EDDiscovery/EDDiscovery,klightspeed/EDDiscovery,EDDiscovery/EDDiscovery,klightspeed/EDDiscovery,klightspeed/EDDiscovery