Avoiding use of non-existent or deprecated Hash method #index or #key