Minor Refactoring to directory.rb