finish data locality code