Optimized module lookup with dictionary.