Adding fully functional solution to problem 10.