add locality function