Serialization

For review reference only. Will be refactored into qexec.