Added support for redirecting to and from files