added functionality to set directory