Make select more flexible. Fixes #7