Modularize lib.js and open-topology.js