Moved template handling to a separate module and updated child module to use that.