working out nml read and write