optimise the time taken