code duplication removal