First pass at patching tools.php