C-style casts replaced for C++ style ones