Refactored the hash creation loop & deleted extra (unneeded) array creation