Solved problem 3 & 4