implemented classify function