Added console logging and a the saving of images in a preview directory