formated and updated to use PDO