added update_image function