optimize tool.sh