refactor selector
select refactor and tests