Correct gear-shifting criteria, additional tests.
Clean up shapefile DBF formatting code, preserve original format unless
data would be corrupted.