Factory for wavefuncs
Rethink data IO API.  Fix bugs therein.