Tidied up and simplified looping constructs.