finalize logging and code