updates to functions, new funciton to clear directory