added better logging