refactor transform code in rendering backend