DRY up streaming and env cleanup