Now we have the `dir' parameter, we should use it where it makes