refactored and changed to different threading and queueing modules for integration with unity