add self enclosed function to encapsulate the block that is called within the loop - mandatory.