refactoring code, removed improper pairs output field as it was unused