Do not call get_unique_id if not needed.

We had a big performance hit from the get_unique_id method, and didn't need it, so moved it to only need as required.