converted to use streams
converted to use streams