Re-solved problem 7