Threads are now working, global_lock added as well