Improve performance of transformation