added code for previously taken images