May I also suggest that 'Optimal_F' is made into a user-supplied function (with current implementation as the default)?