I'm skeptical about the use of synchronous calls here and on line 98. If we call this whole routine `getVerticesSync` and use synchronous calls throughout, then it's all good.