added micro templating borrowed from John Resig and mutated to fit framework needs