Templates refactoring, because of misunderstanding of documentation