added pipe init and cleanup functions