Add error handling.
Use the params of from and dir.