Cleanup some Document code.