optimising problem 7