primary function created by Yang