Added code to save raw input and output