rebuild the add_or_subtract function