Small tweaks and cleanup; Fix selected() usage to return instead of echo