Allowing for passing of cwd to sync function.