Cleanup: Use global $db instead of new PDO where possible