refactored problem11