Got rid of all the unchecked casts.