working on write_payload