Incorporated Custom Minimization into main script.