Several debug assertions.
Got rid of some raw pointers.