refactor program loader