Remove a few raw pointers, correct some signatures, remove some unnecessary handles...