Refine program's structure