Dirty commit ahead of SWI of pull request for MC and EB while temporaril...

...y connected to interwebs. In middle of refactoring from std::queue to more memory efficient model, but basic flow should still be readable.

@eitanbanks @MauricioCarneiro