Updated loop logic for share imports

* Issue #37 updates
* Should stop the infinite loop when the queue = 0