Rework stream I/O functions for markings.