Transform cleanup and optimisation