Add the preview function.