Various optimisation improvements