implement sorted categories