add logging statements + cleanup