Support for multiple template repositories

A working first stab at support for multiple template repositories. Main aim is to allow for internal company repositories so that company specific templates needn't pollute the public repository.
if I'm not mistaken, here we're searching indexes in an undefined order (however they are in the map) - is that dangerous? should we try to take the order from the configuration somehow? what if I want to override a template in one repo with another repo's?