Refactor the row append code into a single function and place in anticipation of a sync call being added at some stage.