Remove unnecessary casting and conversions