Refactored C style casts into C++ style.