Sort does seem to work, not sure what changing the position of the sort effected.
Completes now write to dropbox file