Refactor sort.js to only sort when items are actually moved