Infinite loop test, debug output
Error output+upload
Merge branch 'tidyup'
Tidied up code