added multi-class classification

a generalized version.