Rework

merge the fix for sorting into the master branche