Move stream definition to a separate class