still need a bit of cleanup, but logging works now