first version using streams