use xrange instead of range. shorten differredifference() by removing variables