Condense unique and lowercase checks into one

- This is so we don't iterate over all the hosts twice as this would
  cause the build to slow down.