Updated ui building code so that it uses the new selection api.