Replaced C-style casts
Changed opacity type to eliminate unnecessary casts
Changed trail type to eliminate unnecessary casts