Created by: jdha
There are several occurrences of:
if first time through loop: set some variable
these instances probably need to go into the init