Bring in the code from freed-reader