Refactor geometry, workaround a bug in List.Sort(), generic List mergesort