Flattened graph.js a bit and fixed issue with promises in main.js