added looping through directories