fixing a typo and adding pagination to efficiently query for existing units