Move stream validation into the stream object