Implement CPS transformation