Machine output

fixed the loop bug (non-kludge version)