preview update function