Switched to PDO, added more comments