slight simplification. odd bug when xDim != 100.