Updated middleHelper