Moving stream function to separate file.