modularise stream now working correctly