Added initial support for multiphase transformations, currently not producing correct code