logging and other improvements