code discriminating between function and observable for arithmetic ops refactored