Improving the bifurcation diagram function