Improved db.php