Removed the extra 'optimize' function step