Refactoring repetitive methods