Added sorting by time to getdifference process