Some improvements, almost fixed reference loops of json