improved speed of getDirectory endpoint