Refactored to use HashMap instead of List for better scalability