Register some callbacks for Document