Added script for running optimization cleaned up, plus variable weights