genPreview method is added.