implemented hooker to save output into file