Add stat logging