Used 'cast' to remove SuppressWarnings
Used 'isInstance' to replace 'isAssignableFrom' and added a unit test