simplify stream code