refactor and add spec tests
selectors