Move static optimization part to submitter code