Using built-in contains function instead of linear iteration.