code refractoring for classifier class