Port over more general-purpose methods to the new code generation engine