Modified to work with the modified Cast class.