added applyLocationReg function