Modified setAnd and setPipe, added test codes for it