ENH: reorganize template modules consistently