Improving code of quick union