refactor Select stuff