safer to loop over length of hash