another attempt at stream functions