adding a watch function