Refactored restoring console output and fixed the double output of the result saving