finish category function