Repository: Adding a unit_count method and json