Adding util functions

only for serialising pipes atm