Problem 5 done but should be improved.