added code for figureing out best gapsize