it's better to use collect instead of isInstanceOf, asInstanceOf