Added the preview function