refactored madlibs to accept input stream and output stream