Problem 5

Problem 5 solved, semi-clean