add selected effect and refactor