Balanced logging and some fixes