re-added a working version of rematchtracks. Added an improved splitRegions function.