some improvements for logging and testing