converted assign_categories to S4
added more tests