change to allow directory to be passed