updated code to use named streams