moving to use treeset for min and max