replacing nested calls with pipes