added more code from final counts