optimizing and updating images