made apply_to directory agnostic