Added I/O redirection to revove the overhead of writing a file and read it