Little code simplification

Templates moved into a map. That makes the switch redundant, resulting in simpler and more generic code (adding a new template now requires a change at only a single place in the code).