refactor select updating