Return values instead of out-parameters, and move the error dialog from the reader to the importer so the reader can be unit tested. Fix crash in level detection when erasing while iterating.