added some slightly better logging