DOM generation optimisation