refactor program framework