add script to test cuts
update optimizatiion code