using contains instead indexof
using collect and removing redundant toString