minor refactor in prob2