Core templating engine

Merge before directory structure changes
function skeletal in place.