Finishes solution for problem 4.