Move transform code into its own library