*) updateImage() now takes invalidated as a parameter
*) added example of how to dynamically generate images