Cleaned up and updated for z3 templates only. Tested with Plone 4.3 only
some pep8