Tidied out old stuff -- TODO: make work for both 1d and 2d X+Y.