Cleaned-up selection and fixed issue #227