added tests and templating