remove some duplication in binary operators