optimized code to use HashedString instead of String