moved sorting of topics to JavaScript layer