Cleanup and added second example with nested loops.