Create pipe in Command(), some refactoring