Added functions to index and restore images.