logging + cleanup