converted history to PDO