refactor to allow directory to be moved