Improved performance of OreDictionary

My crack on performance issue mentioned in #1022.