some initial sorting