MSINM-159: Refactoring to move template functionality into a templates module