Refactored to use Hash