Rewrite to use MySQL PDO