Removed Agent, added locking for json serializatin.