Moved directory processing to utility library