Further loop optimisation