Adding Ext5 templates.  General refactoring and cleanup.