Various modifications to tools.rb