Removed deprecated method and casting cleanup.