keeping old write_field subroutine just in case