getdifference fucntion midified