added a script and used the general scipy minimizer function