Added some pipe switching to the model selection code.
The current pipe at the start is stored, and then restored at the end.
Authored by: bugman 2008-07-03
Parent: [r6627]
Child: [r6629]