updated function file for events cpt