code clean up in streams