added the templating. stil incomplete