Re-order updates in javascript.