Speed up getIDs()