added better logging support