added total count and by_command counting