Added some code, moved JSONThread