statistics code enhancements