Added threadsafe queue's & minor bugfix