refactoring: extracting common method