add code to preview