adding functions to write dirs