Use `path` instead of `module.id` and check if modules are used

My first stab at it. I'm not sure if that's the best way of getting the template name.

What do you say?