deal with templates in namespaces better, added some Imagehlp api calls