Added lock diff function