Added mem_istream.
Changed stage_status to lower the number of db lookups.