semi-working diff algorithm