Finally committed code for generic tracks; SQL does not handle discontinous features yet