Made better variable names and fixed local partition scheme.