Re-solved problem 2