Optimize FindMinimum and add a method to test it