finds min and max slopes