viewers function, fixed stream code