hw4 part 3 (Count) small style refactoring