refactoring progs