Added methods to directory.rb