added multi pipe code; base case works, added debug code