The code in wiremaps.js is pretty basic, difficult to maintain and to understand. Rewriting it should give better results.