moved templateroutable to a separate file/lib. added tests.