updated threads with mutex protection, now working on a saftey to handle impartial json objects from blocking the processes.