refactor stream loading