Imprved logging and stats