Refactor control program