major revision on view.php