finish top categories function