clean up forward declarations and dyn_cast