refine option and generic functions for Pipe (#22, #24)