Need to make use of smart pointers, and eliminate all of the gross `static_casts` littered throughout the code.