Changes to template management to allow custon icons in the resource tree

Enhanced version of last commit