selector add and refractor code