optimized guide.php code