modified to  handle template toolkit tags [% %]