preview function init