Allow directory to be passed in.