Finalize ported version of core template compiler