Strip out unneeded stuff in tool.{h,cpp}, fix bug in lookup_tool_target()