Got rid of more dynamic_casts