more qira_program refactoring