Dev: added a dedicated function to sanitize directory names and used it for templates.