refactored onOptionsItemSelected()