cleaned up json.c and disconnectons handled