removed unnecessary code duplication