changed middleware function name to locality