more work on template compiling logic.