Moving update logic out of setSelected