Added saving logs code. In progress.