refactor FindEmptyBucketAndSwap