refactor program