comment in and update function sortFeatures