move read/write functions into nal_header