changed check in method to take an array