improved Stream function