better sorting of js