Re-solved problem 8