duplicate cv sorting from the javascript; fixes #29