create_phi function made