updated for with pipe logic