one function can now take input and output redirection