Product elements to hashtable rewrite

Using a hashtable will make things more readable and less confusing