Admin code cleanup and PDO conversion