Changed the code to only use the 'selectedItem' stuff