code duplication eliminiated