Integrated `select' handling bits from the background resolver project.