update templates. following good coding style. introducing object based permission