Work on poly min/max algorithm