problem 1 solved
Problem one refactored
prob 2