Automatic interface selection

Here's a separate pull request for auto-interface, just to keep track of it. I even got the branches right this time.