eliminating code duplication