added misclassification category; also some small code cleanup