Enhanced tools.rb