added discriminant function