Added more functionality to directory.js