streamlined the script with a hash instead of an array of arrays.