preview function complete