refactor programs controller