Improvement in phi_fun's design