Need to redo the sorting as a message with local memory