Changed the Image object code to use the module pattern. Also changed when state is saved, so fewer saves are performed over the lifetime of the program.