add improved logging