if-then-else necessary in order to return a different output depending on a service response