initial edits to loops - work in progress