Loop phase pointer around when last sample is in last position in the array
Only write to the file/pipe if the data is good and there are no problems
Comment stack operations
Write data to pipe again