refactored test to loop through hash