some cleanup and sort index fixes