cleaning up streaming code