added discrete case