added comments to minmax