How are ref assignments determined?