Wrote a test and fixed some file IO issues; still problems with 'magic value'