added function to execute directly from template