Added functionality that will return the next best quality in case the desired quality cannot be found instead of just returning an error.