Clean up metamethods in Document.lua