Better use of logging