testing and optimisation