Small refactoring. Removed duplicated code with one, template method.