Moving selectedItem calculation outside of the conditional (2)