replaced grep to hash and exists