use factory method to create pipe