Improved numerical modelling of clusters of galaxies