Rebase back to mako plus fixes for inline compiling.