Eliminate code duplication