Excursions in JS, fixed sorting and a few other minor issues