Fixed objective function issue, now produces nice pulses