moved classification code to function categoryClassification