Changed check to hash table and for loop for variables