Refactor - eliminate code duplication