using Chan for simple interaction with pipe