better logging mechanisms, cleanup