more formal scala version, COUNT work well