Improved directory.rb