Made changes to the JS to sort items