refactor problem07