Changed from using is_a to kind_of for checking instances of collections