Working now. Note that the legacy global vars are not updated automatically.