get_shared_key() now automatically sorts computed keys by their usage.

Also, instead of memcpy()ing IDs/keys when they need to be moved within
shared_keys, a pointer to an array is now used.