Replaced unnecessary 'cast' with implicit generic