Sanitize the code to use the new doc abstraction