main private machine loop almost complete