Updated to use min again