Fixed some bugs in parseJSON and updated to improve speed