Refactored duplicated method.