Add return type for write_cmd