refactored problem 25
refactored problem 20
refactored problem 16
refactored problem 14