code review for preview.php