refactor prob2